﻿var tID;
var tn;
var nStopTime = 3000
var nSpeed = 50
var isMove = true;
var nHeight = 20;
var nS = 0
var nNewsCount = 0

function moveT(n)
{
    clearTimeout(tID)
    var noticev2 = document.getElementById("noticev2")
    if (n)
    {
        noticev2.style.lineHeight = nHeight + "px";
        var theText = noticev2.innerHTML.toLowerCase();
        nNewsCount = theText.split("<br>").length
        noticev2.innerHTML += "<br>" + noticev2.innerHTML;
        tn = nHeight;
    }
    nS = nSpeed;
    if (isMove)
    {
        noticev2.style.marginTop = tn + "px";
        if ((tn - 2) % nHeight == 0)
        {
            nS = nSpeed + nStopTime;
        }

        tn--;
        if (Math.abs(tn) == (nNewsCount * nHeight * 2 - nHeight))
            tn = (nNewsCount - 1) * nHeight * -1;
    }

    tID = setTimeout("moveT()", nS);
}

moveT(1);
